package liveData.migration.toPhoenix.util;

import org.apache.kafka.clients.consumer.ConsumerConfig;

import java.util.Properties;

/**
 * @program: userPortrait
 * @description:
 * @author: sunteng
 * @create: 2020-07-10 16:29
 **/
public class KafkaProperties {
    public KafkaProperties() {

    }

    public static KafkaProperties getInstance() {
        return SingleTon.instance;
    }

    private static final class SingleTon {
        private static final KafkaProperties instance = new KafkaProperties();
    }

    public Properties getPropEarliest(String server) {
        Properties properties = new Properties();
        properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, server);
        properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG, ConstantUtil.GROUP_ID);
        properties.setProperty(ConsumerConfig.CLIENT_ID_CONFIG, " ");
        properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");

        return properties;
    }

    public Properties getProp(String server) {
        Properties properties = new Properties();
        properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, server);
        properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG, ConstantUtil.GROUP_ID);
        properties.setProperty(ConsumerConfig.CLIENT_ID_CONFIG, " ");
        properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest");
        return properties;
    }

}
